package campus.controller;

import campus.model.Account;
import campus.model.AccountExample;
import campus.model.Proof;
import campus.service.AccountService;
import campus.service.ProofService;
import campus.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/*
 * @Author: wang
 * @Description:凭证字
 * @Date: 3:48 2020/5/9
 */
@RestController
@CrossOrigin
@RequestMapping("proof")
public class ProofController {
    @Autowired
    private ProofService proofService;

    /*
     * @Author: wang
     * @Description:
     * @Date: 3:48 2020/5/9
     * @param: example
     * @return: java.util.List<campus.model.Account>
     */
    @RequestMapping(value = "/selectByExample",method = RequestMethod.GET)
    public List<Proof> selectByExample(AccountExample example) {
        return proofService.selectByExample(null);
    }



    /**
      * @name  账套添加
     * @Author VULCAN
     * @Date 2020/5/8 1:10
     */
    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    public int insert(@RequestBody Proof record) {
        return proofService.insert(record);
    }

    /*
     * @Author: wang
     * @Description:删除
     * @Date: 4:04 2020/5/9
     * @param: pId
     * @return: int
     */
    @RequestMapping(value = "/delete/{pId}",method = RequestMethod.DELETE)
    public int deleteByPrimaryKey(@PathVariable(value = "pId") Integer pId) {
        return proofService.deleteByPrimaryKey(pId);
    }

    /*
     * @Author: wang
     * @Description:修改
     * @Date: 4:08 2020/5/9
     * @param: record
     * @return: int
     */
    @RequestMapping(value = "/proofUpdate",method = RequestMethod.POST)
    public int updateByPrimaryKeySelective(@RequestBody Proof record) {
        return proofService.updateByPrimaryKeySelective(record);
    }

    /*
     * @Author: wang
     * @Description:查询单个
     * @Date: 4:05 2020/5/9
     * @param: pId
     * @return: campus.model.Proof
     */
    @RequestMapping(value = "/findByPrimaryKey/{pId}",method = RequestMethod.GET)
    public Proof findByPrimaryKey(@PathVariable(value = "pId") Integer pId) {
        return proofService.findByPrimaryKey(pId);
    }
}
